#include <cairo.h>  
#include <gtk/gtk.h>  
   
static gboolean  
on_expose_event(GtkWidget *widget,  
    GdkEventExpose *event,  
    gpointer data)  
{  
  cairo_t *cr;  
   
  cr = gdk_cairo_create(widget->window);  
   
  cairo_set_source_rgb(cr, 0.1, 0.1, 0.1);  
   
   /* 设置字体。这个函数接受了三个字体参数的传入，字体的名称、样式与轻重。 */
  cairo_select_font_face(cr,"Purisa",  
      CAIRO_FONT_SLANT_NORMAL,  
      CAIRO_FONT_WEIGHT_BOLD);  
  /* 设置字体大小 */
  cairo_set_font_size(cr, 13);  
   
  /* 移动到指定位置，并显示相应字符串 */
  cairo_move_to(cr, 20, 30);  
  cairo_show_text(cr,"Most relationships seem so transitory");   
  cairo_move_to(cr, 20, 60);  
  cairo_show_text(cr,"They're all good but not the permanent one");  
   
  cairo_move_to(cr, 20, 120);  
  cairo_show_text(cr,"Who doesn't long for someone to hold");  
   
  cairo_move_to(cr, 20, 150);  
  cairo_show_text(cr,"Who knows how to love you without being told");  
  cairo_move_to(cr, 20, 180);  
  cairo_show_text(cr,"Somebody tell me why I'm on my own");  
  cairo_move_to(cr, 20, 210);  
  cairo_show_text(cr,"If there's a soulmate for everyone");  
   
  /* 释放cr */
  cairo_destroy(cr);  
   
  return FALSE;  
}  
   
   
int main (int argc,char*argv[])  
{  
  GtkWidget *window;  
   
  gtk_init(&argc, &argv);  
   
  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);  
   
  g_signal_connect(window,"expose-event",  
      G_CALLBACK(on_expose_event), NULL);  
  g_signal_connect(window,"destroy",  
      G_CALLBACK(gtk_main_quit), NULL);  
   
  gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);  
  gtk_window_set_default_size(GTK_WINDOW(window), 420, 250);  
  gtk_window_set_title(GTK_WINDOW(window),"Soulmate");  
  gtk_widget_set_app_paintable(window, TRUE);  
   
  gtk_widget_show_all(window);  
   
  gtk_main();  
   
  return 0;  
}  